{extend name="layout"}
{block name="body"}
<section class="wld-content">
  <div class="page_title">社保账单</div>
  <div class="page_title_obj">
    {if !empty($Think.get.stime) ||  !empty($Think.get.etime)}<a class="wld-btn clear" href="/index/insbill/index" style="line-height:30px;margin-right: 16px;">清除</a>{/if}
    <div class="input-item input-icon">
      <input data-date-input="month" name="stime" placeholder="请选择日期" value="{$Think.get.stime|default=''}" class="layui-input" autocomplete="off">
      <i class="iconfont iconweimingmingwenjianjia_rili"></i>
    </div>
    <span class="partition">至</span>
    <div class="input-item input-icon">
      <input data-date-input="month" name="etime" placeholder="请选择日期" value="{$Think.get.etime|default=''}" class="layui-input" autocomplete="off">
      <i class="iconfont iconweimingmingwenjianjia_rili"></i>
    </div>
  </div>
  <div class="con_box layui-form">
	  <div class="con_tag">
		  <a href="{:url('index/insbill/index')}" {if empty($Think.get.status) ||  $Think.get.status eq 0} class="on" {/if}>全部</a>
		  <a href="{:url('index/insbill/index')}?status=1" {if $Think.get.status eq 1} class="on" {/if}>待付款（{$to_pay|default='0'}）</a>
		  <a href="{:url('index/insbill/index')}?status=2" {if $Think.get.status eq 2} class="on" {/if}>待核对</a>
		  <a href="{:url('index/insbill/index')}?status=3" {if $Think.get.status eq 3} class="on" {/if}>已付款</a>
		  <!--<div class="tag_right">
			  <span class="tag_right_exp" data-export-table data-export-url='{:url('index/payment/export')}'>导出所选项</span>
		  </div>-->
	  </div>
    <div class="con_table con_only_table">
      <table class="layui-table table-all" lay-filter="allChoose" lay-skin="nob">
      	{notempty name='list'}
        <colgroup>
          <col width="60">
          <col width="212">
          <col width="162">
          <col width="162">
          <col width="384">
          <col width="168">
          <col width="126">
        </colgroup>
        <thead>
          <tr>
            <th><input type="checkbox" lay-filter="tdChoose" name="" title="" lay-skin="primary"></th>
            <th>账单编号</th>
            <th>所属账期</th>
            <th>应付金额</th> 
            <th>附件</th>            
            <th>创建日期</th>
            <th>状态</th>
            <th style="min-width: 160px;">操作</th>
          </tr>
        </thead>
        {/notempty}
        <tbody>
        	{foreach $list as $key=>$vo}
          <tr>
            <td><input type="checkbox" name="" value="{$vo.id|default='0'}" lay-filter="tdChoose" title="" lay-skin="primary"></td>
            <td>{$vo.code|default=''}</td>
            <td>{$vo.account_period|default=''}</td> 
            <td>{$vo.receivable|default=''}</td>
            <td>
            	{foreach :explode(",",$vo['annex_name']) as $k=>$v}
            		{$v|default=''}<br/>
            	{/foreach} 
            </td>
            <td>{$vo.create_at|date='Y-m-d'}</td>
            <td>
            	{if $vo.status eq 2}
  							<span class="color-green">待付款</span>
  						{elseif $vo.status eq 3}
  							<span class="color-red">待核对</span>
  						{elseif $vo.status eq 4}
  						  <span class="color-desc">已付款</span>
  						{/if}     
            </td>               
            <td class="table_obj" >
              <a href="{:url("index/insbill/download")}?id={$vo.id}">下载</i></a>
              {if $vo.status eq 2}
              <a class="is-pay" href="{:url("index/insbill/payment")}?id={$vo.id}">付款</i></a>
              {elseif $vo.status eq 3}
              <a class="is-pay" href="{:url("index/insbill/payment")}?id={$vo.id}">继续付款</i></a>
              {/if}
            </td>
            </tr> 
					{/foreach} 
        </tbody>

      </table>
      {empty name='list'}
        <div class="con_blank">
            <img src="__ROOT__/static/index/img/con_blank_img.png">
            <p class="con_blank_title">暂无数据</p>
        </div>
        {else}{$list|raw|default=''}{/empty} 
    </div>
  </div>
</section>

{/block}
{block name='script'}
<script>
  $(".page_title_obj").on("change", "input", function () {
    var $inputs = $(".page_title_obj input");
    url = $.menu.getUri()
    $inputs.each(function (index, item) {
      var name = item.name;
      var value = $.trim($(item).val());
      if (value) {
        if (url.indexOf("?") == -1) {
          url += "?" + name + '=' + value
        } else {
          url += "&" + name + '=' + value
        }
      }

    });
    location.href = url
  })
    // $(".page_title_obj").on("click",".clear",function(){

    //     location.href = $.menu.getUri()
    // })

</script>
{/block}


{block name="style"}
<style>
	.table_obj a.is-pay{
		background: #ec494e;
	}
	.table_obj a.is-pay:hover {
		background-color: #ec494e;
		color: #fff;
	}
</style>
{/block}